using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DocManager
{
    public partial class FrmTypeModify : Form
    {
        DocType _docType;

        public DocType DocType
        {
            get { return _docType; }
            set { _docType = value; }
        }
        public FrmTypeModify()
        {
            InitializeComponent();
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
        }

        public FrmTypeModify(DocType docType)
        {
            InitializeComponent();
            _docType = docType;
            txtCode.Text = _docType.TypeCode;
            txtName.Text = _docType.TypeName;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_docType == null)
                _docType = new DocType();
            _docType.TypeCode = txtCode.Text;
            _docType.TypeName = txtName.Text;
            this.DialogResult = DialogResult.OK;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}